<!DOCTYPE html>
<html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-0 vector-toc-not-available vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-0 skin-theme-clientpref-day vector-sticky-header-enabled" lang="de" dir="ltr"><head>
<meta charset="UTF-8">
<title>IronPython</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" href="./_res_/favicon.png">
<link rel="canonical" href="https://de.wikipedia.org/wiki/IronPython"> <link href="./_mw_/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.pygments.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.wikimediamessages.styles.css" rel="stylesheet" type="text/css">
<link href="./_mw_/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./_mw_/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./_mw_/skins.vector.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link href="./_mw_/ext.gadget.citeRef.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.gadget.defaultPlainlinks.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.gadget.dewikiCommonHide.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.gadget.dewikiCommonLayout.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.gadget.dewikiCommonStyle.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.gadget.dewikiDarkmode.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.gadget.dewikiResponsive.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.gadget.specialSearch.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="./_mw_/site.styles.css">
<link rel="stylesheet" type="text/css" href="./_mw_/noscript.css">
<link rel="stylesheet" type="text/css" href="./_res_/footer.css">
<link rel="stylesheet" type="text/css" href="./_res_/vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-IronPython rootpage-IronPython skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-main">IronPython</span></h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="contentSub">
<div id="mw-content-subtitle"></div>
</div>
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="de" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="de" dir="ltr"><table class="float-right infobox toccolours toptextcells" style="font-size:90%; margin-top:0; width:21em;">
<tbody><tr>
<th colspan="2" class="hintergrundfarbe6" style="font-size:larger;">IronPython
</th></tr>
<tr>
<td colspan="2" class="notheme" style="text-align:center; background-color:#f8f9fa;"><span typeof="mw:File"></span><br><span typeof="mw:File"></span>
</td></tr>
<tr>
<th colspan="2" class="hintergrundfarbe5" style="font-size:105%; text-align:center;">Basisdaten
</th></tr>
<tr>
<td><b>Erscheinungsjahr:</b>
</td>
<td><span class="wikidata-content">5. September 2006</span>
</td></tr>
<tr>
<td><b>Designer:</b>
</td>
<td><span class="wikidata-content">Jim Hugunin</span>
</td></tr>
<tr>
<td><b>Entwickler:</b>
</td>
<td>Jim Hugunin, <a href="Microsoft" title="Microsoft">Microsoft</a>
</td></tr>
<tr>
<td><b>Aktuelle <a href="Version_(Software)" title="Version (Software)">Version</a></b>
</td>
<td class="wikidata-content" style="white-space:nowrap;">3.4.2<sup id="cite_ref-_df5e2d60b42c3f2b_1-0" class="reference"><a href="#cite_note-_df5e2d60b42c3f2b-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> <small>(20. Dezember 2024)</small>
</td></tr>
<tr>
<td><b>Aktuelle Vorabversion:</b>
</td>
<td style="white-space:nowrap;">3.4.0-beta1<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> <small>(01. Mai 2022)</small>
</td></tr>
<tr>
<td><b><a href="Betriebssystem" title="Betriebssystem">Betriebssystem</a>:</b>
</td>
<td><a href="Plattformunabh%C3%A4ngigkeit" title="Plattformunabhängigkeit">Plattformunabhängig</a>
</td></tr>
<tr>
<td><b><a href="Lizenz" title="Lizenz">Lizenz</a>:</b>
</td>
<td><a href="Apache-Lizenz" title="Apache-Lizenz">Apache-Lizenz 2.0</a>
</td></tr>
<tr>
<td colspan="2" class="hintergrundfarbe5" style="text-align:center;"><a rel="nofollow" class="external text" href="https://ironpython.net/">ironpython.net</a>
</td></tr></tbody></table>
<p><b>IronPython</b> ist eine Implementierung der Programmiersprache <a href="Python_(Programmiersprache)" title="Python (Programmiersprache)">Python</a> für die <a href="Common_Language_Infrastructure" title="Common Language Infrastructure">Common Language Infrastructure</a> (CLI) bzw. damit kompatible <a href="Laufzeitumgebung" title="Laufzeitumgebung">Laufzeitumgebungen</a> wie z. B. <a href="Mono_(Software)" title="Mono (Software)">Mono</a>.
</p><p>IronPython ist vollständig in <a href="C-Sharp" title="C-Sharp">C#</a> geschrieben und wird im Rahmen der <a href="Apache-Lizenz" title="Apache-Lizenz">Apache-Lizenz 2.0</a> bereitgestellt. IronPython ist je nach Version 2 oder 3 im Sprachumfang kompatibel zu <a href="CPython" class="mw-redirect" title="CPython">CPython</a> 2.7 bzw. 3.x, wird aber ohne die Python-Standard-Bibliothek ausgeliefert. Es lassen sich jedoch sämtliche Module einer CPython-Installation laden, solange diese keine kompilierten Bibliotheken benötigen. Zugriff auf <a href=".Net-Framework" title=".Net-Framework">.NET</a>-Assemblies ist uneingeschränkt möglich.
</p><p>In IronPython erstellte Programme lassen sich sowohl <a href="Interpreter" title="Interpreter">interpretieren</a> als auch <a href="Just-in-time-Kompilierung" title="Just-in-time-Kompilierung">just-in-time</a> in ausführbare Dateien übersetzen. Wie in .NET üblich, kann man mit IronPython auf Bibliotheken zugreifen, die in anderen .NET-Sprachen geschrieben wurden, ebenso wie diese mit Einschränkungen auf in IronPython geschriebene Bibliotheken zugreifen können.
</p><p>Die IronPython-Umgebung kann als eine Skriptsprache zum Automatisieren einer .NET-Anwendung genutzt werden. Dabei wird die Laufzeitumgebung in die .NET-Anwendung eingebunden. Es können beliebige Objekte an das Skript übergeben werden, was z. B. für Spieleerweiterungen oder <a href="Plug-in" title="Plug-in">Plug-in</a>-Entwicklungen sinnvoll ist.
</p>
<div class="mw-heading mw-heading2"><h2 id="Beispiele">Beispiele</h2></div>
<p>Eine Ausgabe ohne .NET-Bibliothek:
</p>
<div class="mw-highlight mw-highlight-lang-python mw-content-ltr" dir="ltr"><pre><span></span><span class="nb">print</span> <span class="s2">"Hallo Welt!"</span>
</pre></div>
<p>Das gleiche Beispiel, diesmal mit einer „internen“ .NET-Bibliothek:
</p>
<div class="mw-highlight mw-highlight-lang-python mw-content-ltr" dir="ltr"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">System</span><span class="w"> </span><span class="kn">import</span> <span class="n">Console</span>
<span class="n">Console</span><span class="o">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s2">"Hallo Welt!"</span><span class="p">)</span>
</pre></div>
<p>Und einmal mit Hilfe einer „externen“ .NET-Bibliothek, wobei die <i>MyLib.dll</i> in einer beliebigen anderen <a href="Liste_der_.NET-Sprachen" class="mw-redirect" title="Liste der .NET-Sprachen">.NET-Sprache</a> (z. B. <a href="C-Sharp" title="C-Sharp">C#</a>, <a href="Visual_Basic_.NET" title="Visual Basic .NET">Visual Basic .NET</a> oder <a href="C%2B%2B/CLI" title="C++/CLI">C++/CLI</a>) geschrieben sein kann:
</p>
<div class="mw-highlight mw-highlight-lang-python mw-content-ltr" dir="ltr"><pre><span></span><span class="kn">import</span><span class="w"> </span><span class="nn">clr</span>
<span class="n">clr</span><span class="o">.</span><span class="n">AddReferenceToFile</span><span class="p">(</span><span class="s2">"MyLib.dll"</span><span class="p">)</span>
<span class="kn">from</span><span class="w"> </span><span class="nn">MyLib</span><span class="w"> </span><span class="kn">import</span> <span class="n">Out</span>
<span class="n">Out</span><span class="o">.</span><span class="n">Print</span><span class="p">(</span><span class="s2">"Hallo Welt!"</span><span class="p">)</span>
</pre></div>
<p>IronPython in C# einbinden (z. B. als Taschenrechner):
</p>
<div class="mw-highlight mw-highlight-lang-csharp mw-content-ltr" dir="ltr"><pre><span></span><span class="k">using</span><span class="w"> </span><span class="nn">System</span><span class="p">;</span>
<span class="k">using</span><span class="w"> </span><span class="nn">IronPython.Hosting</span><span class="p">;</span>
<span class="k">using</span><span class="w"> </span><span class="nn">Microsoft.Scripting.Hosting</span><span class="p">;</span>
<span class="k">public</span><span class="w"> </span><span class="k">class</span><span class="w"> </span><span class="nc">Eval</span>
<span class="p">{</span>
<span class="w"> </span><span class="k">public</span><span class="w"> </span><span class="k">static</span><span class="w"> </span><span class="k">void</span><span class="w"> </span><span class="nf">Main</span><span class="p">(</span><span class="kt">string</span><span class="p">[]</span><span class="w"> </span><span class="n">args</span><span class="p">)</span>
<span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="n">ScriptEngine</span><span class="w"> </span><span class="n">se</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Python</span><span class="p">.</span><span class="n">CreateEngine</span><span class="p">();</span>
<span class="w"> </span><span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">se</span><span class="p">.</span><span class="n">Execute</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]));</span>
<span class="w"> </span><span class="p">}</span>
<span class="p">}</span>
</pre></div>
<p>Angenommen das C#-Programm liegt als <i>eval.exe</i> kompiliert vor und die IronPython-Laufzeitbibliotheken <i>IronPython.dll</i> und <i>IronMath.dll</i> (z. B. in demselben Verzeichnis) sind vorhanden, können beliebige Python-Ausdrücke ausgewertet werden:
</p>
<div class="mw-highlight mw-highlight-lang-text mw-content-ltr" dir="ltr"><pre><span></span> C:\> eval.exe 2+2
4
C:\> eval.exe 2**3
8
C:\> eval.exe 5%3
2
</pre></div>
<p>In einem Tutorial, das mit dem IronPython-Paket mitgeliefert wird, ist ein Beispiel zu sehen, wie IronPython als Skriptsprache für C# benutzt werden kann.
</p>
<div class="mw-heading mw-heading2"><h2 id="Siehe_auch">Siehe auch</h2></div>
<ul><li><a href="Python_(Programmiersprache)" title="Python (Programmiersprache)">Python</a>, die Programmiersprache Python</li>
<li><a href="Jython" title="Jython">Jython</a>, Java-Implementierung der Programmiersprache Python</li>
<li><a href="PyPy" title="PyPy">PyPy</a>, Implementierung der Programmiersprache Python in Python selbst</li>
<li><a href="Boo_(Programmiersprache)" title="Boo (Programmiersprache)">Boo</a>, Implementierung der Python-ähnlichen Programmiersprache Boo für .NET</li></ul>
<div class="mw-heading mw-heading2"><h2 id="Einzelnachweise">Einzelnachweise</h2></div>
<ol class="references">
<li id="cite_note-_df5e2d60b42c3f2b-1"><span class="mw-cite-backlink"><a href="#cite_ref-_df5e2d60b42c3f2b_1-0">↑</a></span> <span class="reference-text"><a rel="nofollow" class="external text" href="https://github.com/IronLanguages/ironpython3/releases/tag/v3.4.2"><cite style="font-style:italic"><span lang="en">Release 3.4.2</span></cite>.</a> 20. Dezember 2024 (abgerufen am 24. Dezember 2024).</span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text"><a rel="nofollow" class="external text" href="https://github.com/IronLanguages/ironpython3/releases/tag/v3.4.0-beta1">Release 3.4.0-beta1</a> auf github.com</span>
</li>
</ol>
<div class="mw-heading mw-heading2"><h2 id="Weblinks">Weblinks</h2></div>
<ul><li><a rel="nofollow" class="external text" href="https://ironpython.net/">Offizielle Website</a></li>
<li><a rel="nofollow" class="external text" href="https://github.com/IronLanguages/ironpython2">IronPython 2</a> auf <a href="GitHub" title="GitHub">GitHub</a></li>
<li><a rel="nofollow" class="external text" href="https://github.com/IronLanguages/ironpython3">IronPython 3</a> auf <a href="GitHub" title="GitHub">GitHub</a></li>
<li><a rel="nofollow" class="external text" href="http://www.freiesmagazin.de/mobil/freiesMagazin-2012-07-bilder.html#12_07_ironpython">Artikel über IronPython im freiesMagazin 07/2012</a> (deutsch)</li>
<li><a rel="nofollow" class="external text" href="https://docs.python.org/library/">The Python Standard Library</a></li></ul></div><!--htdig_noindex--><div><div class="zim-footer">
Dieser Artikel wurde von <a class="external text" title="Zuletzt bearbeitet am 2025-12-13" href="https://de.wikipedia.org/wiki/?title=IronPython&oldid=262397928">Wikipedia</a> herausgegeben. Der Text ist unter <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.de">Creative Commons Attribution-Share Alike 4.0</a> verfügbar, sofern nicht anders angegeben. Für die Mediendateien können zusätzliche Bedingungen gelten.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>
<script src="./_webp_/webpHandler.js"></script>
</body></html>